@isTest
public with sharing class Test_AT_Opportunity_Trigger_Handler
{
	static testMethod void main_test() 
	{
		ID RT_Account_B2B = [select ID from RecordType r where SobjectType='Account' and DeveloperName='B2B' limit 1].ID;

        AT_sendIntacctCallOut.isTest = true;
 		Account acc = new Account(RecordTypeId=RT_Account_B2B, Name='test Account B2B', BillingCountry='USA');
 		insert acc;
		
		ID RT_Product2_MPE = [select ID from RecordType r where SobjectType='Product2' and DeveloperName='Manual_Product_Entry' limit 1].ID;
		
		Product2 prod = new Product2(Name='Test Prod - 1', CurrencyIsoCode='USD', Item_Type1__c='Inventory', Parent_GL_Group__c='Rev_Full', RecordTypeId=RT_Product2_MPE, isactive=TRUE);
		insert prod;
		
		ID RT_Opportunity_Inc = [select ID from RecordType r where SobjectType='Opportunity' and DeveloperName='Inc' limit 1].ID;
		Opportunity opp = new Opportunity(Name='Test Opp - 1', AccountId=acc.ID, CurrencyIsoCode='USD', CloseDate=date.today(), RecordTypeId=RT_Opportunity_Inc);
		opp.StageName = 'Prospecting';
		opp.Probability = 10;
		opp.Class_Name__c = 'RESELLERS';
		opp.Location_Name__c = 'SAS_USA'; 
		insert opp;
		
		//Pricebook2 pbook = new Pricebook2(Name = 'Name Price Book Test - 1');
		//insert pbook;
		Pricebook2 pbook = [select id from Pricebook2 where isStandard=true limit 1];
		
		
		PricebookEntry pbookEntry = new PricebookEntry(Pricebook2Id=pbook.ID,Product2Id=prod.ID, UnitPrice=0.00, IsActive=TRUE, UseStandardPrice=FALSE);
		insert pbookEntry;
		
		//Select o.Quantity, o.PricebookEntryId, o.OpportunityId From OpportunityLineItem o
		OpportunityLineItem oppLineItem = new OpportunityLineItem(OpportunityId=opp.ID, PricebookEntryId=pbookEntry.id, Quantity=10, UnitPrice = 100);
		insert oppLineItem;
		
		System.Test.startTest();
		
		opp.StageName = 'Closed Won';
		opp.Probability = 100;
		update opp;
		
		System.Test.stopTest();
	}

}